import json, os, re
from core.base_tornado_request_handler import BaseTornadoRequestHandler
from db import LogsDB

class ApiScreenshotHandler(BaseTornadoRequestHandler):
  async def get(self, action):
    if action == "get_screenshot":
      filepath = self.get_query_argument("path")
      screenshot_dir = os.path.join(os.getenv("SCREENSHOT_DIR"), filepath)
      filelist = os.listdir(screenshot_dir)
      self.return_json(filelist)